#include <iostream>
#include <opencv2/opencv.hpp>
#include "windmill.hpp"
#include "method.hpp"
int main()
{
    double t0 = std::chrono::system_clock::now().time_since_epoch().count() / 1e9;
    WINDMILL::WindMill wm(t0);
    METHOD m;
    double time = t0;
    int flag = 0;
    int cnt=0;
    do
    {
        cnt++;
        time = std::chrono::system_clock::now().time_since_epoch().count() / 1e9;
        cv::Mat show = wm.getMat(time);
        //#########################################################################################
        m.searchCenter(show);
        if (flag == 0)
        {
            m.leadFirstVector(time);
            flag = 1;
        }
        m.calculateRadius(time, show);
        //#########################################################################################
        cv::imshow("show", show);
    } while (cv::waitKey(1) != 'q');
    double t1 = std::chrono::system_clock::now().time_since_epoch().count() / 1e9;
    std::cout << (t1-t0)/cnt<< std::endl;
    std::cout<<"angle : "<<m.angle<<std::endl;
    return 0;
}